<!DOCTYPE html>
<html>
<head>
    <title>E8NET</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <include file="./App/Admin/View/Include/css.html" />
    <link href="__PUBLIC__/Admin/css/lib/select2.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/form-showcase.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<include file="./App/Admin/View/Include/navbar.html" />
<include file="./App/Admin/View/Include/menu.html" />

<!-- main container -->
<div class="content">


    <div role="breadcrumb">
        <ol class="breadcrumb">
            <li><a href="{:U('Student/index')}">学生管理</a> / </li>
            <li class="active">添加信息</li>
        </ol>
    </div>

    <div class="container-fluid">

        <div id="pad-wrapper" class="form-page">
            <div class="row-fluid form-wrapper">
                <!-- left column -->
                <div class="span6 column offset3">
                    <form id="sadmin-form" />

                    <div class="field-box">
                        <label>二级学院名称:</label>
                        <input class="span8 inline-input"   type="text" value="{$S[2]}" disabled/>
                        <input type="hidden" value="{$ID.x_id}" name = "id" id = "x_id">
                        <br>
                        <span id="xy_msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>

                    <div class="field-box" id="mojor_select">
                        <label>专业名称:</label>
                        <input class="span8 inline-input"  type="text" value="{$S[1]}" disabled/>
                        <input type="hidden" value="{$ID.z_id}" name = "id" id = "z_id">
                        <br>
                        <span id="zy_msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>

                    <div class="field-box" id="mojor_select_bj">
                        <label>班级名称</label>
                        <input class="span8 inline-input"   type="text" value="{$S[0]}" disabled/>
                        <input type="hidden" value="{$ID.c_id}" name = "id" id = "c_id">
                        <br>
                        <span id="bj_msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>

                    <div class="field-box">
                        <label>学生学号</label>
                        <input class="span8 inline-input" id = "s_num" name="num" placeholder="请输入学生学号" type="text" />
                        <br>
                        <span id="xh_msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>

                    <div class="field-box">
                        <label>学生姓名</label>
                        <input class="span8 inline-input" id = "s_name" name="name" placeholder="请输入学生姓名" type="text" />
                        <br>
                        <span id="xm_msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>


                    <div class="span6 field-box actions" style="padding-left:360px;">

                        <a href="javascript:add();" class="btn-flat default">
                            提交表单
                        </a>
                        <a href="{:U('index')}" class="btn-flat gray">
                            放弃提交
                        </a>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end main container -->

<include file="./App/Admin/View/Include/js.html" />
<script src="__PUBLIC__/Admin/js/jquery-latest.js"></script>
<script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.uniform.min.js"></script>
<script src="__PUBLIC__/Admin/js/select2.min.js"></script>



<script type="text/javascript">
    function add() {
        var x_id = $('#x_id').val();
        var z_id = $('#z_id').val();
        var c_id = $('#c_id').val();
        var num  = $('#s_num').val();
        var name = $('#s_name').val();

        if(num == ""){
            $('#xh_msg >small').html('学号不能为空!');
            $('#xh_msg').show();
            return;
        }else if("" == name){
            $('#xm_msg >small').html('姓名不能为空!');
            $('#xm_msg').show();
            return;
        }

        $.post('__APP__/Student/add',{x_id:x_id,z_id:z_id,c_id:c_id,num:num,name:name}, function (result) {
            var obj = eval('(' + result + ')');
            if (obj.result == "RESULT_OK") {
                window.location.href = obj.data;
            } else {
                $('#xh_msg > small').html(obj.msg);
                $('#xh_msg').show();
            }

        });

    }
</script>


</body>
</html>